<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<script type="text/javascript" src="js/jquery.itextclear.js"></script>
<!-- jQplot CSS -->
<link rel="stylesheet" media="screen" href="css/Tree.css" />
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="lib/datatables/css/vpad.css" />
<!-- DATATABLES CSS END -->
<h1 class="page-title">教材资源管理 - 额外教具</h1>
<div class="container_12 clearfix leading">
	<div class="side grid_12 leading">
		<form class="form has-validation" id="post_form" name="post_form">
			<div class="clear"></div>
			<div class="clearfix">
				<label for="form-email" class="form-label">额外教具申请内容<em>*</em></label>
				<div class="form-input">
					<textarea name="externRealiaDesc" required="required"
						id="externRealiaDesc" placeholder="请输入需申请的额外教具的名称">${externRealiaDesc}</textarea>
				</div>

			</div>

			<div class="clearfix"></div>
			<div class="form-action clearfix">
				<button class="button" type="button" onclick="checkForm()">
					<s:if test="#request.planId > 0">修改</s:if>
					<s:else>添加</s:else>
				</button>
				<button class="button" type="reset">重置</button>
				<a class="button" href="javascript:void(0)"
					onclick="javascript:history.back()"><span
					style="background: url(${ctx}/images/img/arrow_undo.png)"
					class="icon">&nbsp;</span>返回</a>

			</div>
		</form>
	</div>
</div>

<div class="clear"></div>

<script type="text/javascript">
	function checkForm() {
		if ($("#externRealiaDesc").val() == null || $("#externRealiaDesc").val() == "") {
			alert("请输入额外教具名称");
			return;
		}
		var url = "${ctx}/train/post_externrealia_apply.xhtml";
		$
				.ajax(
						url,
						{
							type : "POST",
							data : {"planId":${planId},"externRealiaDesc":$("#externRealiaDesc").val()},
							dataType : "html",
							cache : false,
							success : function(a) {
								alert("提交成功");
								window.location.href = "${ctx}/index.xhtml#train/materresource_main.xhtml?tab=realia";
							},
							error : function(XMLHttpRequest, textStatus,
									errorThrown) {
								alert('提交申请发生异常');
							},
							complete : function() {
							}
						});

	}

	
</script>